package com.atguigu.chaptar1

object $04_for {
  def main(args: Array[String]): Unit = {
    for(a<- 1 to 10 by 2){
      println(a)
    }
    println("*" * 100)
    for(i<-1 to 10){
      if(i%2==0){
        println(s"${i}")
      }
    }
    println("_"*100)
    for(i<-1 to 10 if(i%2==0) if(i%4==0)){
      println(s"i=${i}")
    }
    println("="*100)
    for(i<-1 to 10){
      for(j<-1 to i){
        println(s"i + j = ${i+j}")
      }
    }
    println("_"*100)

    for(i<-1 to 10; j<- 1 to i){
      println(s"i + j = ${i+j}")
    }
    for(i <- 1 to 10 if(i%2==0);k=i*i; j <- 1 to k if(i%4==0)){
      println(s"i + j = ${i+j}")
    }
    val a =for(i <- 1 to 10)yield{
      val k=i*i
      k
    }
    println(a.toList)
    var aaa = 1
   var fds= while(aaa<10){
      aaa=aaa+1
    }
    println(fds)
  }


}
